const ApiDef = require('./impl')
const kong_cfg = configure.get('kong')

class pluginService {
    constructor (ctx) {
        this.apiBaseUrl = kong_cfg.kong_admin
    }
    list (name,data = {}) {
        return ApiDef.get(`${this.apiBaseUrl}services/${name}/plugins`, data)
    }

    add (name,data) {
        return ApiDef.post(`${this.apiBaseUrl}services/${name}/plugins`, data)
    }

    update (name,data) {
        return ApiDef.patch(`${this.apiBaseUrl}plugins/${name}`, data)
    }

    delete (name) {
        return ApiDef.delete(`${this.apiBaseUrl}plugins/${name}`)
    }
}

module.exports = new pluginService()

